package com.alterzhang.userservice.proxy.zshproxy;


import com.alterzhang.userservice.proxy.HuangNiu;

import java.lang.reflect.Method;

public class zshActureProxy implements zshInvocationHandler {


    private HuangNiu person;

    public Object getInstance(HuangNiu target) {
        this.person = target;
        Class clazz = target.getClass();
        return zshproxy.newProxyInstance(new zshClassLoader(), clazz.getInterfaces(), this);
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("开始动态代理");
        method.invoke(this.person,args);
        return null;
    }
}
